package forums.service;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.security.RolesAllowed;

import org.springframework.stereotype.Component;

import forums.model.Message;

/*
 * Author       :       Willie Wheeler and John Wheeler
 * Book         :       'Spring In Practice' [Book written by Willie Wheeler and John Wheeler]
 */
@Component
public class MessageListFilter {
	
	/**
	 * <p>
	 * Returns a copy of the original list of messages, with unauthorized
	 * messages removed.
	 * </p>
	 * 
	 * @param orig
	 * @return
	 */
	@RolesAllowed({ "IS_AUTHENTICATED_ANONYMOUSLY", "AFTER_ACL_COLLECTION_READ" })
	public List<Message> filter(List<Message> orig) {
		return new ArrayList<Message>(orig);
	}
}
